linux添加硬盘后识别不到不重启(linux无法识别新添加硬盘) |
您所在的位置:网站首页 › linux 新加硬盘 › linux添加硬盘后识别不到不重启(linux无法识别新添加硬盘) |
开机出现invalid partition table咋办 linux不重启识别新添加的硬盘
查看磁盘分区信息 $ fdisk -lDisk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectorsrack, 3916 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000c20c5Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 64 2611 20458496 8e Linux LVMDisk /dev/mapper/vg_centos6-lv_root: 18.8 GB, 18798870528 bytes255 heads, 63 sectorsrack, 2285 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_centos6-lv_swap: 2147 MB, 2147483648 bytes255 heads, 63 sectorsrack, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 创建新的分区格式化未使用的磁盘空间 $ fdisk /dev/sdaWARNING: DOS-compatible mode is deprecated. It's strongly recommended toswitch off the mode (command 'c') and change display units tosectors (command 'u').Command (m for help): n #添加新的分区Command actione extendedp primary partition (1-4)p #主分区Partition number (1-4): 3 #分区号First cylinder (2611-3916, default 2611):Using default value 2611Last cylinder, +cylinders or +size{K,M,G} (2611-3916, default 3916):Using default value 3916Command (m for help): t #格式化Partition number (1-4): 3 #需要格式化的分区Hex code (type L to list codes): 8e #分区格式Changed system type of partition 3 to 8e (Linux LVM)Command (m for help): w #保存退出The partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks. 查看分区信息 $ fdisk -lDisk /dev/sda: 32.2 GB, 32212254720 bytes255 heads, 63 sectorsrack, 3916 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000c20c5Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 64 2611 20458496 8e Linux LVM/dev/sda3 2611 3916 10483750 8e Linux LVMDisk /dev/mapper/vg_centos6-lv_root: 18.8 GB, 18798870528 bytes255 heads, 63 sectorsrack, 2285 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_centos6-lv_swap: 2147 MB, 2147483648 bytes255 heads, 63 sectorsrack, 261 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 看到/dev/sda3分区已经成功,但是没法使用,是因为分区表没更新,根据提示使用partprobe命令更新分区表,如果没有此命令,请安装parted包 $ partprobeWarning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may notreflect all of your changes until after reboot.Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.Error: Invalid partition table - recursive partition on /dev/sr0.$ ll /dev/sdasda sda1 sda2 此时我们创建的sda3分区根本没显示出来,分区表更新失败 查看官网文档,解决 :https://access.redhat.com/solutions/57542 官网给出原因: partprobe在RHEL5中常用于通知操作系统磁盘上的分区表更改。在RHEL6中,只有当那些磁盘上任何分区都没有在使用的磁盘下(例如,mounted)它才会触发OS去更新磁盘的分区表。如果正在使用磁盘上的任何分区,partprobe则不会触发操作系统更新系统中的分区,因为在某些情况下它被认为是不安全的。 推荐解决 : 在修改磁盘上的分区表之前卸载磁盘的所有分区,然后运行partprobe以更新系统中的分区。如果无法做到这一点(例如,挂载的分区是系统分区),请在修改分区表后重新引导系统。重启后将重新读取分区信息。更新分区表信息如果添加了新分区且未修改任何现有分区,请考虑使用该partx命令更新系统分区表 列出分区表 $ partx -l /dev/sda# 1: 2048- 1026047 ( 1024000 sectors, 524 MB)# 2: 1026048- 41943039 ( 40916992 sectors, 20949 MB)# 3: 41943040- 62910539 ( 20967500 sectors, 10735 MB)# 4: 0- -1 ( 0 sectors, 0 MB) 读取磁盘并尝试将所有分区添加到系统 $ partx -v -a /dev/sdadevice /dev/sda: start 0 size 62914560gpt: 0 slicesdos: 4 slices# 1: 2048- 1026047 ( 1024000 sectors, 524 MB)# 2: 1026048- 41943039 ( 40916992 sectors, 20949 MB)# 3: 41943040- 62910539 ( 20967500 sectors, 10735 MB)# 4: 0- -1 ( 0 sectors, 0 MB)BLKPG: Device or resource busyerror adding partition 1BLKPG: Device or resource busyerror adding partition 2added partition 3出现添加1,2分区错误是正常的,因为1,2分区已经添加过了 再去查看系统,已经正常/dev/sda3 已经显示 $ ls /dev/sda*/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 linux中新建硬盘后怎样才能不重启 linux无法识别新添加硬盘 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |